package com.goodving.guli.utility;

import android.text.format.Time;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

/**
 * Created by Administrator on 2015/11/16 0016.
 */
public class LdlDate extends Date {
    public static final double f4876a = 6.40922112E10d;
    private double f4877b;

    private LdlDate() {
        super(System.currentTimeMillis());
        this.f4877b = 0.0d;
        this.f4877b = ((double) System.currentTimeMillis()) / 1000.0d;
    }

    public static LdlDate m8857a(double d) {
        return new LdlDate(d);
    }

    public static LdlDate m8859a(long j) {
        return new LdlDate(j);
    }

    public static LdlDate m8856a() {
        return new LdlDate();
    }

    public static LdlDate m8858a(int i, int i2, int i3, int i4, int i5, int i6) {
        Calendar instance = Calendar.getInstance();
        instance.set(Calendar.YEAR, i);
        instance.set(Calendar.MONTH, i2);
        instance.set(Calendar.DATE, i3);
        instance.set(Calendar.HOUR_OF_DAY, i4);
        instance.set(Calendar.MINUTE, i5);
        instance.set(Calendar.SECOND, i6);
        return new LdlDate(Long.valueOf(instance.getTime().getTime()).longValue());
    }

    public static long m8860b() {
        return (long) (TimeZone.getDefault().getRawOffset() - TimeZone.getTimeZone("GMT+8:00").getRawOffset());
    }

    public LdlDate m8866c() {
        return LdlDate.m8857a(m8876i().m8883p() + ((double) LdlDate.m8860b()));
    }

    private LdlDate(double d) {
        super((long) (1000.0d * d));
        this.f4877b = 0.0d;
        this.f4877b = d;
    }

    public LdlDate(long j) {
        super(j);
        this.f4877b = 0.0d;
        this.f4877b = ((double) j) / 1000.0d;
    }

    private LdlDate(int i, int i2, int i3, int i4, int i5, int i6) {
        super(i, i2, i3, i4, i5, i6);
        this.f4877b = 0.0d;
//        Log.e("errordata", C3459a.f15323b + i + ":" + i2 + ":" + i3 + ":" + i4 + ":" + i5);
    }

    public boolean m8863a(Date LdlDate) {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        Calendar instance2 = Calendar.getInstance();
        instance2.setTime(LdlDate);
        if (instance.get(Calendar.YEAR) == instance2.get(Calendar.YEAR)) {
            return true;
        }
        return false;
    }

    public LdlDate m8869d() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        instance.set(Calendar.MONTH, 0);
        instance.set(Calendar.DATE, 0);
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(instance.getTime().getTime());
    }

    public LdlDate m8870e() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        instance.set(Calendar.DATE, 1);
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(instance.getTime().getTime());
    }

    public LdlDate m8872f() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        instance.set(Calendar.DATE, instance.getActualMaximum(Calendar.DATE));
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(instance.getTime().getTime());
    }

    public LdlDate m8874g() {
        return m8862a(2);
    }

    public LdlDate m8862a(int i) {
        Calendar instance = Calendar.getInstance();
        instance.setFirstDayOfWeek(i);
        instance.setTime(this);
        instance.set(Calendar.DAY_OF_WEEK, i);
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(instance.getTime().getTime());
    }

    public boolean m8865b(LdlDate LdlDate) {
        return m8876i().m8867c(LdlDate.m8876i());
    }

    public LdlDate m8875h() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        instance.add(Calendar.DATE, -1);
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(Long.valueOf(instance.getTime().getTime()).longValue());
    }

    public LdlDate m8876i() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(Long.valueOf(instance.getTime().getTime()).longValue());
    }

    public LdlDate m8877j() {
        return m8878k();
    }

    public LdlDate m8878k() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        instance.add(Calendar.DATE, 1);
        instance.set(Calendar.HOUR_OF_DAY, 0);
        instance.set(Calendar.MINUTE, 0);
        instance.set(Calendar.SECOND, 0);
        instance.set(Calendar.MILLISECOND, 0);
        return new LdlDate(Long.valueOf(instance.getTime().getTime()).longValue());
    }

    public LdlDate m8879l() {
        return LdlDate.m8857a(this.f4877b - 86400.0d);
    }

    public LdlDate m8880m() {
        return LdlDate.m8857a(this.f4877b + 86400.0d);
    }

    public LdlDate m8881n() {
        return m8861b(0, 0, -1, 0, 0, 0);
    }

    public boolean m8867c(LdlDate LdlDate) {
        return getTime() == LdlDate.getTime();
    }

    public LdlDate m8882o() {
        return m8861b(0, 0, 1, 0, 0, 0);
    }

    public double m8868d(LdlDate LdlDate) {
        return ((double) (getTime() - LdlDate.getTime())) / 1000.0d;
    }

    public double m8883p() {
        return this.f4877b;
    }

    private LdlDate m8861b(int i, int i2, int i3, int i4, int i5, int i6) {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);

        instance.add(Calendar.YEAR, i);
        instance.add(Calendar.MONTH, i2);
        instance.add(Calendar.DATE, i3);
        instance.add(Calendar.HOUR_OF_DAY, i4);
        instance.add(Calendar.MINUTE, i5);
        instance.add(Calendar.SECOND, i6);
        return new LdlDate(Long.valueOf(instance.getTime().getTime()).longValue());
    }

    public String toString() {
        Time time = new Time("GMT+8");
        time.set(getTime());
        int i = time.month + 1;
        int i2 = time.monthDay;
        int i3 = time.minute;
        int i4 = time.hour;
        return "" + i + "/" + i2 + " " + i4 + ":" + i3 + ":" + time.second;
    }

    public boolean equals(Object obj) {
        if ((obj instanceof LdlDate) && ((LdlDate) obj).m8883p() == this.f4877b) {
            return true;
        }
        return false;
    }

    public boolean m8871e(Date LdlDate) {
        if (!m8863a(LdlDate)) {
            return false;
        }
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        Calendar instance2 = Calendar.getInstance();
        instance2.setTime(LdlDate);
        if (instance.get(Calendar.MONTH) == instance2.get(Calendar.MONTH)) {
            return true;
        }
        return false;
    }

    public boolean equals(LdlDate LdlDate) {
        return m8864a(LdlDate, 2);
    }

    public boolean m8864a(LdlDate LdlDate, int i) {
        if (LdlDate.m8888u().before(this) || LdlDate.m8887t().after(this)) {
            return false;
        }
        Calendar instance = Calendar.getInstance();
        instance.setFirstDayOfWeek(i);
        instance.setTime(this);
        Calendar instance2 = Calendar.getInstance();
        instance2.setFirstDayOfWeek(i);
        instance2.setTime(LdlDate);
        if (instance.get(Calendar.WEEK_OF_YEAR) == instance2.get(Calendar.WEEK_OF_YEAR)) {
            return true;
        }
        return false;
    }

    public int getDate() {
        Date LdlDate = new LdlDate();
        LdlDate.setTime(((long) this.f4877b) * 1000);
        Calendar instance = Calendar.getInstance();
        instance.setTime(LdlDate);
        return instance.get(Calendar.DATE);
    }

    public int getMonth() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        return instance.get(Calendar.MONTH);
    }

    public int getDay() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        int i = instance.get(Calendar.DAY_OF_WEEK);
        if (i == 1) {
            return 7;
        }
        return i - 1;
    }

    public LdlDate m8887t() {
        return m8861b(0, 0, -7, 0, 0, 0);
    }

    public LdlDate m8888u() {
        return m8861b(0, 0, 7, 0, 0, 0);
    }

    public LdlDate m8889v() {
        return m8861b(0, 1, 0, 0, 0, 0);
    }

    public LdlDate m8890w() {
        return m8861b(0, -1, 0, 0, 0, 0);
    }

    public int m8891x() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(this);
        return instance.getActualMaximum(Calendar.DATE);
    }
}
